<?php defined('IN_IA') or exit('Access Denied');?><!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><?php  echo $active['title'];?></title>
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/theme/public.min.css?v=20181228">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/css/ft-carousel.css?v=20181228">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min.css?v=20181228">
    <link rel="stylesheet" href="<?php echo WEB_RESOURCE;?>/mobile/css/index.css?v=2019010901">
    <?php (!empty($this) && $this instanceof WeModuleSite) ? (include $this->template('base/sysinfo', TEMPLATE_INCLUDEPATH)) : (include template('base/sysinfo', TEMPLATE_INCLUDEPATH));?>
    <style>
        .rule_hide{overflow:hidden;position:relative;height:166px;padding-bottom:25px}
        .rule_hide::after{content:'';position: absolute;left: 0;bottom: 0;width: 100%;height: 25px;background: linear-gradient(-180deg,rgba(255,255,255,0) 0%,#fff 70%);}
        pre{white-space: pre-wrap;white-space: -moz-pre-wrap; white-space: -pre-wrap;white-space: -o-pre-wrap;word-wrap: break-word;line-height: 20px;}
        .register .agreement{display:block;width:70%;margin:12px auto;font-size:12px;}
        .register input[type="checkbox"]{display:none;}
        .register input[type="checkbox"] + .agreement-input{display:inline-block;position:relative;width:14px;height:14px;border:1px solid #ccc;border-radius:2px;vertical-align:sub;}
        .register input[type="checkbox"]:checked + .agreement-input::after{content:' ';display:block;position:absolute;top:-2px;left:1px;width:12px;height:6px;border-left:4px solid #d40001;border-bottom:4px solid #d40001;transform-origin:center;transform:rotate(-45deg);}
    </style>
</head>

<body>
    <img src="<?php  echo tomedia($active['cover']);?>" style="display:none">
    <!-- 顶部 -->
    <div class="top">
        <div class="list_desc">
            <ul class="top_list" id="top_list">
                <?php  if(is_array($buys)) { foreach($buys as $buy) { ?>
                <li>
                    <img src="<?php  echo tomedia($buy['avatar']);?>" style="border-radius:50%;margin-left:0">
                    <span>恭喜<?php  echo $buy['nickname'];?>购买成功</span>
                </li>
                <?php  } } ?>
            </ul>
        </div>
        <?php  if((empty($order) || $order['status'] != 'pay_done') && !empty($active['music'])) { ?>
        <audio id="Jaudio" class="media-audio" src="<?php  echo tomedia($active['music']);?>" loop="true"></audio>
        <div class="music_control btn-ani">
            <img class="play_btn" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/music.png">
        </div>
        <?php  } else if(!empty($active['music_order'])) { ?>
        <audio id="Jaudio" class="media-audio" src="<?php  echo tomedia($active['music_order']);?>" loop="true"></audio>
        <div class="music_control btn-ani">
            <img class="play_btn" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/music.png">
        </div>
        <?php  } ?>
    </div>
    <!-- 顶部 -->
    <!-- 按钮 -->
    <div class="use_btn">
        <ul class="btn_r">
            <li class="share">
                <a href="javascript:;">
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/share.png">
                </a>
            </li>
            <li>
                <a href="tel:<?php  echo $active['tel'];?>">
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/phone.png">
                </a>
            </li>
            <li>
                <a href="<?php  echo web2app_url('personalCenter', ['et'=>'index', 'pid'=>$active['id']])?>">
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/personal.png">
                </a>
            </li>
            <?php  if(!empty($myMchId)) { ?>
            <li>
                <a href="<?php  echo web2app_url('mchCenter', ['et'=>'mchCenter', 'pid'=>$active['id']])?>">
                    <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/mch_logo.png">
                </a>
            </li>
            <?php  } ?>
        </ul>
        <?php  if(empty($myMchId)) { ?>
        <div class="btn_l join_btn">
            <a href="<?php  echo web2app_url('main', ['et'=>'join','pid'=>$active['id']])?>">
                <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/join.png">
            </a>
        </div>
        <?php  } ?>
    </div>
    <!-- 按钮 -->
    <!-- 首图 -->
    <div class="head">
        <img src="<?php  echo tomedia($active['cover']);?>">
    </div>
    <!-- 首图 -->
    <?php  if($active['signin_status'] == 'on' && $active['signin_times'] > 0) { ?>
    <!-- 分享得礼包 -->
    <div class="share_star clearfix">
        <div class="star fl">
            <?php  if(!empty($signinLog)) { ?>
            <?php  for($i = 1; $i <= $active['signin_times']; $i++) { ?> <span class="star_state">
                <?php  if($i <= $signinLog['count']) { ?> 
                    <img class="" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/star-on.png">
                <?php  } else { ?>
                    <img class="" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/star-off.png">
                <?php  } ?>
                    </span>
            <?php  } ?>
            <?php  } else { ?>
            <?php  for($i = 0; $i < $active['signin_times']; $i++) { ?> <span class="star_state">
                <img class="star_off" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/star-off.png">
                </span>
            <?php  } ?>
            <?php  } ?>
    
        </div>
        <div class="gift_box fr gift_ani">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/gift.png">
        </div>
    </div>
    <!-- 分享得礼包 -->
    <?php  } ?>
    <!-- 倒计时 -->
    <div class="time">
        <p class="number"><?php  echo $active['views_all'];?>人浏览，<?php  echo $active['views'];?>人参与</p>
        <div class="countdown">
            <span id="count">
                <span class="viewtime-day"></span>天<span class="viewtime-hour"></span>时<span class="viewtime-minute"></span>分<span
                    class="viewtime-second"></span>秒
            </span>
            <p>距离活动结束</p>
        </div>
    </div>
    <!-- 倒计时 -->
    <?php  if($active['mch_sets_type'] == 'show') { ?>
    <!-- 联盟商家 -->
    <div class="alliance">
        <div class="title">
            <img src="<?php echo WEB_RESOURCE;?>/mobile/images/6.png">
            <p>商家排名不分前后</p>
        </div>
        <div class="alliance_con clearfix">
            <div class="slide_con">
            </div>
        </div>
    </div>
    <!-- 联盟商家 -->
    <?php  } ?>
    <?php  if($active['mch_list_type'] == 'slider') { ?>
    <!-- 免单详情 -->
    <div class="free">
        <div class="free_title">
            免单详情
        </div>
        <div class="free_l fl"></div>
        <div class="free_r fr"></div>
        <div class="swiper-container">
            <div class="swiper-wrapper">

            </div>
        </div>
        <img class="desc_more" src="<?php echo WEB_RESOURCE;?>/mobile/images/13.png">
        <img class="text_more" src="<?php echo WEB_RESOURCE;?>/mobile/images/17.png">
    </div>
    <!-- 免单详情 -->
    <?php  } else if($active['mch_list_type'] == 'list') { ?>
    <!-- 免单详情列表 -->
    <div class="free_list">
        <div class="free_title">
            免单详情
        </div>

    </div>
    <!-- 免单详情列表 -->
    <?php  } ?>
    <!-- 活动规则 -->
    <div class="rules" style="margin-bottom:20px">
        <div class="rule_title">
            活动规则
        </div>
        <div class="rule_con">
            <!-- <pre class="rule_desc"><?php  echo $active['rules_desc'];?></pre> -->
            <div class="rule_hide"><?php  echo $active['rules'];?></div>
            <img class="more" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/more.png">
        </div>
    </div>
    <!-- 活动规则 -->
    <!-- 红包排行榜 -->
    <div class="rank">
        <div class="none"></div>
        <div class="list_red">
            <ul class="list" id="list">
                <?php  if(is_array($reds)) { foreach($reds as $red) { ?>
                <li>
                    <img src="<?php  echo tomedia($red['avatar']);?>" style="border-radius:50%">
                    <p class="name"><?php  echo $red['nickname'];?></p>
                    <p class="money fr"><?php  echo $red['get_reward'];?> 元</p>
                </li>
                <?php  } } ?>
                <?php  if(empty($reds)) { ?>
                <p style="text-align:center;width:100%;line-height: 280px">暂时无人领取红包</p>
                <?php  } ?>
            </ul>
        </div>
    </div>
    <!-- 红包排行榜 -->
    <?php  if($active['tickets_list_type'] == 'always' || ($active['tickets_list_type'] == 'after_order' && $order['status'] == 'pay_done')) { ?>
    <!-- 美食特区 -->
    <div class="food">
        <div class="food_title">
            卡券列表
        </div>
        <ul class="food_con">
            <?php  if(is_array($tickets)) { foreach($tickets as $ticket) { ?>
                <li>
                    <a href="<?php  echo $ticket['mch_link'];?>">
                        <img class="food_shop" src="<?php  echo tomedia($ticket['avatar']);?>" style="border-radius:50%">
                        <ul class="shop_ticketet" style="width:50%">
                            <li style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php  echo $ticket['mch_name'];?></li>
                            <li style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php  echo $ticket['address'];?></li>
                            <?php  if($ticket['time_type'] == 'endtime') { ?>
                            <li><?php  echo date('Y-m-d', $ticket['end_time'])?>到期</li>
                            <?php  } else if($ticket['time_type'] == 'endtime_period') { ?>
                            <li>领取后<?php  echo $ticket['endtime_period'];?>天内有效</li>
                            <?php  } ?>
                        </ul>
                    </a>
                    <div class="price fr">
                        <p><?php  echo $ticket['amount'];?></p>
                        <p class="unit">元</p>
                    </div>
                    <div class="getControll">
                        <?php  if(!empty($ticket['getted'])) { ?>
                        <img class="get_a" src="<?php echo WEB_RESOURCE;?>/mobile/images/18.png" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">
                        <?php  } else { ?>
                        <img class="get" src="<?php echo WEB_RESOURCE;?>/mobile/images/12.png" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">
                        <?php  } ?>
                    </div>
                </li>
            <?php  } } ?>
        </ul>
        <!-- <ul class="food_con">
            <?php  if(is_array($tickets)) { foreach($tickets as $ticket) { ?>
            <span><?php  echo $ticket['indestry_name'];?></span>
            <li>
                <a href="<?php  echo $ticket['mch_link'];?>">
                    <img class="food_shop" src="<?php  echo tomedia($ticket['avatar']);?>" style="border-radius:50%">
                    <ul class="shop_ticket">
                        <li><?php  echo $ticket['mch_name'];?></li>
                        <li style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"><?php  echo $ticket['address'];?></li>
                        <?php  if($ticket['time_type'] == 'endtime') { ?>
                        <li><?php  echo date('Y-m-d', $ticket['end_time'])?>到期</li>
                        <?php  } else if($ticket['time_type'] == 'endtime_period') { ?>
                        <li>领取后<?php  echo $ticket['endtime_period'];?>天内有效</li>
                        <?php  } ?>
                    </ul>
                </a>
                <div class="price fr">
                    <p><?php  echo $ticket['amount'];?></p>
                    <p class="unit">元</p>
                </div>
                <div class="getControll">
                    <?php  if(!empty($ticket['getted'])) { ?>
                    <img class="get_a" src="<?php echo WEB_RESOURCE;?>/mobile/images/18.png" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">
                    <?php  } else { ?>
                    <img class="get" src="<?php echo WEB_RESOURCE;?>/mobile/images/12.png" data-ticket-id="<?php  echo $ticket['ticket_id'];?>">
                    <?php  } ?>
                </div>
            </li>
            <?php  } } ?>
        </ul> -->
    </div>
    <!-- 美食特区 -->
    <?php  } ?>
    <!-- 底部 -->
    <div class="foot">
        <div class="foot_btn">
            <button class="share_btn">马上赚钱</button>
            <?php  if(!empty($order) && $order['status'] == 'pay_done' && !empty($active['pay_done_btn_name'])) { ?>
            <button class="a_btn" style="width:130%"><?php  echo $active['pay_done_btn_name'];?></button>
            <?php  } ?>
            <?php  if(empty($order) || $order['status'] == 'wait_pay') { ?>
            <button class="rush" style="width:130%"><?php  echo $active['price'];?>元立即抢购</button>
            <?php  } ?>
        </div>
    </div>
    <!-- 底部 -->
    <?php  if($order['status'] != 'pay_done') { ?>
    <!-- 报名 -->
    <div class="register_bg">
        <form class="register" id="form" action="<?php  echo web2app_url('main', ['et'=>'createOrder'])?>">
            <span id='close'>x</span>
            <input type="hidden" name="active_id" value="<?php  echo $active['id'];?>">
            <input type="hidden" name="order_sn" value="<?php  echo $order['order_sn'];?>">
            <input type="hidden" name="oid" value="<?php  echo $_GPC['oid'];?>">
            <input type="hidden" name="oi" value="<?php  echo $_GPC['oi'];?>">
            <input type="text" name="name" placeholder="请输入姓名" value="<?php  echo $order['name'];?>">
            <input type="text" name="mobile" placeholder="请输入电话号码" value="<?php  echo $order['mobile'];?>">
            <label class="agreement">
                <input type="checkbox" id="agreement" checked class="agreement-input">
                <span class="agreement-input"></span>&emsp;我已认真阅读并同意活动规则
            </label>
            <button id="purchase">开始抢购</button>
        </form>
    </div>
    <!-- 报名 -->
    <?php  } ?>

    <!-- 分享 -->
    <div class="share_bg">
        <div class="share_main">
            <span>发送给好友</span>
            <div class="img_box">
                <img class="share_pic" src="<?php  echo $posters;?>" alt="">
            </div>
            <input class="close_share" type="button" value="关闭">
        </div>
    </div>
    <!-- 分享 -->

    <?php  if(!empty($active['pay_done_cover'])) { ?>
    <!-- 支付成功 -->
    <div class="success">
        <img class="success_img" src="<?php  echo tomedia($active['pay_done_cover']);?>" alt="" <?php  if(!empty($active['pay_done_link'])) { ?>
            onclick=" location.href='<?php  echo $active['pay_done_link'];?>' " <?php  } ?>> <img class="success_close" src="<?php echo WEB_RESOURCE;?>/mobile/images/icon/close.png"
            alt="">
    </div>
    <!-- 支付成功 -->
    <?php  } ?>

    <?php  echo $active['support_name'];?>

    <script src="<?php echo WEB_RESOURCE;?>/lib/require.min.js?v=20181228"></script>
    <script type="text/javascript" src="./resource/js/lib/mui.min.js?v=20181228"></script>
    <script>
        require.config({
            baseUrl: '.',
            paths: {
                'jquery': '<?php echo WEB_RESOURCE;?>/lib/jquery/jquery.min',
                'marque': '<?php echo WEB_RESOURCE;?>/mobile/js/marque',
                'tool': '<?php echo WEB_RESOURCE;?>/mobile/js/tool',
                'ft-carousel': '<?php echo WEB_RESOURCE;?>/mobile/js/ft-carousel',
                'util': 'resource/js/app/util',
                'wx': '',
                'swiper': '<?php echo WEB_RESOURCE;?>/lib/swiper/swiper.min',
                'barrager': '<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/jquery.barrager.min'
            },
            map: {'*': {'css': '<?php echo WEB_RESOURCE;?>/lib/css.min.js'}},
            shim: {
                'tool': {
                    deps: ['jquery']
                },
                'ft-carousel': {
                    deps: ['jquery']
                },
                'util': { deps: ['jquery'] },
                'barrager': {deps: ['jquery', 'css!<?php echo WEB_RESOURCE;?>/lib/jquery/barrager/barrager.min']}
            },
            proiority: ['jquery']
        });
        // 接口地址
        var url = {
            alliance: "<?php  echo aurl('alliance')?>",
            free: "<?php  echo aurl('freeDetails')?>",
            rank_list: "<?php  echo aurl('rank')?>"
        }
        // 分享
        window.SHARE_TRIGGER = function () {
            location.reload()
        }
        <?php echo js_share($active["share_text"], $active["share_desc"], $domainurl, !empty($active['share_image']) ? tomedia($active['share_image']) : '', ["pid"=> $active["id"], "oid"=> $_GPC["oid"]])?>
        // 开始抢购
        require(['jquery'], function () {
            function show_form() {
                if(location.hash == '#/show_form') {
                    $('.register_bg').show();
                }
            }
            window.addEventListener('hashchange', function(e) {
                show_form();
            }, false);
            show_form();
            $('.rush').on('click', function (event) {
                event.preventDefault();
                $('.register_bg').show();
            });
            $('#close').on('click', function () {
                $('.register_bg').hide();
                location.hash = '/';
            })
        });
        // 倒计时
        require(['jquery', 'tool'], function ($) {
            // console.log(changeViewTime);
            changeViewTime('<?php  echo $active["outtime"];?>', '#count');
        });
        // 音乐
        require(['jquery'], function ($) {
            wx.ready(function () {
                var audio;
                function audioAutoPlay() {
                    audio = document.getElementById('Jaudio');
                    audio.play()
                    var play = 1;
                    $(".music_control").click(function () {
                        if (play == 1) {
                            $(this).removeClass('btn-ani');
                            audio.pause()
                            play = 0;
                        }
                        else {
                            $(this).addClass('btn-ani');
                            audio.play()
                            play = 1;
                        }
                    });
                }
                audioAutoPlay();
            })
        });
        // 联盟商家
        require(['jquery', 'util'], function ($, util) {
            // $.post(url.alliance).then(function(res) {
            //     var data = res.data;
            var data = <?php  echo json_encode($mchs)?>;
            var shop_temp = '\
                <div class="slide">\
                    <div class="slide_t">\
                        <a href="{{shop1_href}}" class="slide_href">\
                            <img src="{{shop1_img}}" class="slide_img">\
                            <p class="slide_text">{{shop1_name}}</p>\
                        </a>\
                    </div>\
                    <div class="slide_b">\
                        <a href="{{shop2_href}}" class="slide_href">\
                            <img src="{{shop2_img}}" class="slide_img">\
                            <p class="slide_text">{{shop2_name}}</p>\
                        </a>\
                    </div>\
                </div>\
                ';
            var shop_sum = '';
            for (var i = 0; i < data.length; i += 2) {
                // console.log(data[i].shop1_href)
                // for(var i in data) {
                var shop = shop_temp
                    .replace(/{{shop1_href}}/g, data[i].mch_link)
                    .replace(/{{shop1_img}}/g, util.tomedia(data[i].avatar))
                    .replace(/{{shop1_name}}/g, data[i].name)
                // }
                if (data[i + 1] != undefined) {
                    shop = shop
                        .replace(/{{shop2_href}}/g, data[i + 1].mch_link)
                        .replace(/{{shop2_img}}/g, util.tomedia(data[i + 1].avatar))
                        .replace(/{{shop2_name}}/g, data[i + 1].name)
                }
                shop_sum += shop;
            }
            $('.slide_con').append(shop_sum);
            if ($('.slide:last').find('.slide_b').find('p').html() == '{{shop2_name}}') {
                $('.slide:last').find('.slide_b').remove()
            }
            var w = $('.slide').width();
            var l = $('.slide').size();
            $('.slide_con').css('width', w * l + 'px');
            // });
        });
    </script>
    <script>
        // 免单详情
        require(['jquery', 'util', 'swiper'], function ($, util, Swiper) {
            // $.post(url.free).then(function(res) {
            // var data = res.data;
            var data = <?php  echo json_encode($mchs)?>;
            var free_temp = '\
                <div class="swiper-slide">\
                    <div class="desc_t">\
                        <img class="shop_pic fl" src="{{shop_pic}}">\
                        <ul class="fl" style="margin-left:20px">\
                            <li>\
                                <i class="name_icon"></i>\
                                <p>{{shop_name}}</p>\
                            </li>\
                            <li>\
                                <i class="phone_icon"></i>\
                                <a href="tel:{{shop_tel}}">{{shop_tel}}</a>\
                            </li>\
                            <li>\
                                <i class="address_icon"></i>\
                                <a href="javascript:;">{{shop_address}}</a>\
                            </li>\
                        </ul>\
                    </div>\
                    <div class="desc_b">\
                        <a href="{{shop_href}}"><img src="{{shop_cover}}"></a>\
                    </div>\
                </div>\
                ';
            var free_sum = '';
            for (var i in data) {
                free_sum += free_temp.replace(/{{shop_pic}}/g, util.tomedia(data[i].avatar))
                    .replace(/{{shop_name}}/g, data[i].name)
                    .replace(/{{shop_tel}}/g, data[i].mobile)
                    .replace(/{{shop_address}}/g, data[i].address)
                    .replace(/{{shop_href}}/g, data[i].mch_link)
                    .replace(/{{shop_cover}}/g, util.tomedia(util.tomedia(data[i].cover)))
            }
            $('.swiper-wrapper').append(free_sum);
            $('.free_list').append(free_sum);
            // 免单详情动
            var mySwiper = new Swiper('.swiper-container', {
                direction: 'horizontal', // 水平切换选项
                loop: true, // 循环模式选项
                // 自动切换
                autoplay: true,
                autoplay: {
                    disableOnInteraction: false,
                }
            });
            // });
        });
        // 红包排行榜
        require(['jquery', 'marque'], function ($) {
            // $.post(url.rank_list).then(function(res) {
            //     var data = res.data;
            //     var rank_temp = '\
            //     <li>\
            //         <img src="{{user_pic}}">\
            //         <p class="name">{{user_name}}</p>\
            //         <p class="money fr">{{red_package}}</p>\
            //     </li>\
            //     ';
            //     var rank_sum = '';
            //     for(var i in data) {
            //         rank_sum += rank_temp.replace(/{{user_pic}}/g, data[i].user_pic)
            //                             .replace(/{{user_name}}/g, data[i].user_name)
            //                             .replace(/{{red_package}}/g, data[i].red_package)
            //     }
            //     $('#list').append(rank_sum);
            // });
            marque('#list', 70, 4, 3);
            marque('#top_list', 30, 1, 3);
        });

        // 活动规则
        require(['jquery'], function ($) {
            $('.more').on('click', function () {
                var toggle = $(this).attr('data-toggle');
                if (!toggle || toggle == 'off') {
                    $(this).attr('data-toggle', 'on');
                    $('.rule_hide').css('height', 'auto');
                } else {
                    $(this).attr('data-toggle', 'off');
                    $('.rule_hide').css('height', '166px');
                }
                // $('.rule_hide').toggle();
                // $('.rule_desc').toggle();
            });
        });
        // 美食休闲
        require(['jquery'], function ($) {
            $('.get').on('click', function () {

                $.post('<?php  echo web2app_url("main", ["et"=>"getTicket"])?>', {
                    'pid': "<?php  echo $active['id'];?>",
                    'ticket_id': $(this).attr('data-ticket-id'),
                }).then(function (res) {
                    alert(res.message);
                    if (res.errno == 0) {
                        $(this).prop('src', '<?php echo WEB_RESOURCE;?>/mobile/images/18.png');
                    } else {
                        location.hash = '/show_form';
                    }
                });

                // alert('参加活动即可领取')
            });
        });
        require(['jquery'], function ($) {
            $('.gift_box').on('click', function () {
                <?php  if($signinLog['count'] < $active['signin_times']) { ?>
                alert('连续分享<?php  echo $active['signin_times'];?>天可得红包')
                <?php  } else { ?>
                $.post('<?php  echo web2app_url("main", ["et"=>"getSigninReward"])?>', {
                    pid: "<?php  echo $_GET['pid'];?>"
                }).then(function (res) {
                    alert(res.message);
                    if(res.errno == 0) {
                        location.reload();
                    }
                });
                <?php  } ?>
            });
        });
    </script>
    <script>
        require(['jquery', 'util'], function ($, util) {
            $(window).on('load', function () {
                var ls = window.localStorage.getItem('pay');
                if (typeof ls == 'string') {
                    try {
                        ls = JSON.parse(ls);
                    } catch (error) {
                        ls = {};
                    }
                }

                // 支付中监听、10分钟以内的订单
                if (ls.result == 'wait' && ls.time + 600 > '<?php  echo TIMESTAMP?>') {
                    <?php  if($order['status'] == 'pay_done') { ?>
                    ls.result = 'success';
                    ls.time = '<?php  echo TIMESTAMP?>';
                    ls.sn = '<?php  echo $order["order_sn"];?>';
                    window.localStorage.setItem('pay', JSON.stringify(ls));

                    $('.success').show();
                    <?php  } ?>//
                }

            });
            $('.success_close').on('click', function () {
                $('.success').hide();
            })
            $('#form').on('submit', function () {
                $.post($(this).prop('action'), $(this).serialize()).then(function (res) {
                    if (typeof res == 'string') {
                        res = JSON.parse(res);
                        if (typeof res.url != 'undefined') {
                            alert('请授权您的微信基本信息后再报名');
                            location.href = res.url;
                        }
                        if(!$('#agreement').prop('checked')) {
                            alert("请同意活动规则后报名");
                            return false;
                        }
                    } else {
                        if (res.errno != 0) {
                            alert(res.message);
                            return false;
                        }
                        var data = res.data;
                        var ls = {
                            sn: data.order_sn,
                            result: 'wait',
                            time: data.time
                        };
                        window.localStorage.setItem('pay', JSON.stringify(ls));
                        if (data.servername != data.pay_url && data.pay_url != '') {
                            location.href = data.payment;
                        } else {
                            util.pay({
                                orderFee: data.price,
                                payMethod: 'wechat',
                                orderTitle: "<?php  echo $active['title'];?>",
                                orderTid: data.order_sn,
                                module: '<?php  echo MNAME?>',
                                success: function () {
                                    location.reload();
                                },
                                fail: function (e) {
                                    alert('报名失败，请稍后重试');
                                },
                                complete: function (e) {
                                    // alert('报名完成');
                                }
                            });
                        }
                    }

                })
                return false;
            });
        });
         // 分享
        require(['jquery','tool'], function($) {
            $('.share').on('click', function() {
                $('.share_bg').show();
                <?php  if(empty($order) || $order['status'] != 'pay_done') { ?>
                $('#Jaudio').prop('src', '<?php  echo tomedia($active['music_order']);?>');
                <?php  } ?>
            });
            $('.share_btn').on('click', function() {
                $('.share_bg').show();
                <?php  if(empty($order) || $order['status'] != 'pay_done') { ?>
                $('#Jaudio').prop('src', '<?php  echo tomedia($active['music_order']);?>');
                <?php  } ?>
            });
            $('.close_share').on('click', function() {
                $('.share_bg').hide();
            });
            $('.a_btn').on('click', function() {
                $('.success').show();
            });
            img2base64('.share_pic');
        });

        <?php  if($active['show_barrager'] == 'on') { ?>
        require(['jquery','barrager'], function($) {
            $.post('<?php  echo web2app_url("main", ["et"=>"getBullet"])?>', {
                pid: '<?php  echo $active["id"];?>',
                page: 1
            }).then(function (res) {
                if (res.errno == 0) {
                    var data = res.data,
                        i = 0,
                        len = 100;
                    setInterval(function () {
                        run(data[i++ % len], data[i++ % len], data[i++ % len]);
                        i %= len;
                    }, 835);
                }
            })

            // 一次走三个
            function run(a, b, c) {
                if (typeof a == 'string') {
                    $('body').barrager({
                        info: a,
                        speed: 10,
                        close: false
                    });
                }
                if (typeof b == 'string') {
                    $('body').barrager({
                        info: b,
                        speed: 10,
                        close: false
                    });
                }
                if (typeof c == 'string') {
                    $('body').barrager({
                        info: c,
                        speed: 10,
                        close: false
                    });
                }
            }
        });
        <?php  } ?>

    </script>
<script>;</script><script type="text/javascript" src="http://www.onfinger.cn/app/index.php?i=3&c=utility&a=visit&do=showjs&m=szxh_alliad"></script></body>

</html>
<!-- <script>var we7CommonForModule // document.body.appendChild(we7CommonForModule)</script> -->